package com.szty.lib_pen.oidbluetooth;


import com.tqltech.tqlpencomm.bean.Dot;

import java.io.Serializable;

public class Dots implements Serializable {

    public Dot dot;

    public Dots(Dot dot, int color, int width) {
        this.dot = dot;
        this.ncolor = color;
        this.penWidth = width;

        this.bookID = dot.BookID;
        this.pageID = dot.PageID;
        this.force = dot.force;
        this.ncounter = dot.Counter;
        this.nangle = dot.angle;

        int tmpx = dot.x;
        this.pointX = dot.fx;
        this.pointX /= 100.0;
        this.pointX += tmpx;

        int tmpy = dot.y;
        this.pointY = dot.fy;
        this.pointY /= 100.0;
        this.pointY += tmpy;

        if (dot.type == Dot.DotType.PEN_DOWN) {
            this.ntype = 0;
        } else if (dot.type == Dot.DotType.PEN_MOVE) {
            this.ntype = 1;
        } else if (dot.type == Dot.DotType.PEN_UP) {
            this.ntype = 2;
        }


    }


    public Dots(int BookID, int PageID, float x, float y, int f, int t, int width, int color, int counter, int angle) {
        bookID = BookID;
        pageID = PageID;
        pointX = x;
        pointY = y;
        force = f;
        ntype = t;
        penWidth = width;
        ncolor = color;
        ncounter = counter;
        nangle = angle;
    }

    public int bookID;
    public int pageID;
    public int ncounter;
    public float pointX;
    public float pointY;
    public int force;
    public int ntype;  //0-down;1-move;2-up;
    public int penWidth;
    public int ncolor;
    public int nangle;

    @Override
    public String toString() {
        return "Dots{" +
                "bookID=" + bookID +
                ", pageID=" + pageID +
                ", ncounter=" + ncounter +
                ", pointX=" + pointX +
                ", pointY=" + pointY +
                ", force=" + force +
                ", ntype=" + ntype +
                ", penWidth=" + penWidth +
                ", ncolor=" + ncolor +
                ", nangle=" + nangle +
                '}';
    }
}
